Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import { NextResponse } from 'next/server' import { getRoomById } from '@/lib/arcade/room-manager' import { getOnlineMemberCount, getRoomMembers } from '@/lib/arcade/room-membership' import { withAuth } from '@/lib/auth/withAuth' /** * GET /api/arcade/rooms/:roomId/members * Get all members in a room */ export const GET = withAuth(async (_request, { params }) => { try { const { roomId } = (await params) as { roomId: string } // Get room const room = await getRoomById(roomId) if (!room) { return NextResponse.json({ error: 'Room not found' }, { status: 404 }) } // Get members const members = await getRoomMembers(roomId) const onlineCount = await getOnlineMemberCount(roomId) return NextResponse.json({ members, onlineCount, }) } catch (error) { console.error('Failed to fetch members:', error) return NextResponse.json({ error: 'Failed to fetch members' }, { status: 500 }) } }) |